package ch3;

public class NumSort {
	public static void main(String[] args) {
		int [] a = {2, 4, 6, 7, 3, 5, 1, 9, 8};
		int [] b;
		print(a);
		sort(a);
		print(a);
	}
	
	public static void sort(int [] arr) {
		for(int i = 0; i < arr.length; i ++) {
			for(int j = i +1; j < arr.length; j++) {
				if(arr[j] < arr[i]) {
					int temp = arr[i];
					arr[i] = arr[j];
					arr[j] = temp;
				}
			}
		}
	}
	
	public static void print(int [] a) {
		for(int i = 0; i < a.length; i++) {
			System.out.print(a[i] + " ");
		}
		System.out.println();
	}
	
}
